package persistence;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import model.*;
import model.beneficioVenta.*;
import model.condicionesVenta.*;
import model.descuentoVenta.*;
import model.factura.*;
import model.orden.*;
import model.proveedor.*;
import model.remito.*;
import model.solicitud.*;

public class HibernateUtil {

	private static final SessionFactory sessionFactory;
    static
    {
        try
        {
        	 AnnotationConfiguration config = new AnnotationConfiguration();
        	 config.addAnnotatedClass(Rodamiento.class);
        	 config.addAnnotatedClass(BeneficioVenta.class);
        	 config.addAnnotatedClass(BenFrecuencia.class);
        	 config.addAnnotatedClass(BenMonto.class);
        	 config.addAnnotatedClass(BenVolumen.class);
        	 config.addAnnotatedClass(CondicionVenta.class);
        	 config.addAnnotatedClass(Financiacion.class);
        	 config.addAnnotatedClass(PagoContado.class);       	 
        	 config.addAnnotatedClass(ItemOrden.class);
        	 config.addAnnotatedClass(ItemOrdenCompra.class);
        	 config.addAnnotatedClass(ItemOrdenPedido.class);
        	 config.addAnnotatedClass(OrdenCompra.class);
        	 config.addAnnotatedClass(OrdenPedido.class);        	 
        	 config.addAnnotatedClass(Cliente.class);
        	 config.addAnnotatedClass(ItemListaPrecio.class);
        	 config.addAnnotatedClass(ItemRemito.class);
        	 config.addAnnotatedClass(Remito.class);
        	 config.addAnnotatedClass(RemitoCliente.class);
        	 config.addAnnotatedClass(RemitoProveedor.class);
        	 config.addAnnotatedClass(DescuentoVenta.class);
        	 config.addAnnotatedClass(DescCompetencia.class);
        	 config.addAnnotatedClass(DescExcesoStock.class);
        	 config.addAnnotatedClass(DescFormaPago.class);
        	 config.addAnnotatedClass(DescOferta.class);
        	 config.addAnnotatedClass(DescTipoItems.class);
        	 config.addAnnotatedClass(DescVentasHistoricas.class);
        	 config.addAnnotatedClass(DescVolumen.class);
        	 config.addAnnotatedClass(ItemSolicitud.class);
        	 config.addAnnotatedClass(ItemSolicitudCotizado.class);
        	 config.addAnnotatedClass(Solicitud.class);
        	 config.addAnnotatedClass(SolicitudCotizada.class);
        	 config.addAnnotatedClass(ItemFactura.class);
        	 config.addAnnotatedClass(Factura.class);
        	 config.addAnnotatedClass(ItemStock.class);
        	 config.addAnnotatedClass(Proveedor.class);
        	 config.addAnnotatedClass(ListaPrecio.class);
        	 
        	 sessionFactory = config.buildSessionFactory();
        }
        catch (Throwable ex)
        {
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }
 
    public static SessionFactory getSessionFactory()
    {
        return sessionFactory;
    }
}
